# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-python-geoip
pkgname=('python2-python-geoip' 'python-python-geoip')
_pkgname=python-geoip
pkgver=1.2
pkgrel=9
pkgdesc='Provides GeoIP functionality for Python.'
arch=('any')
url='https://pypi.org/project/python-geoip/#files'
license=('custom:unknown')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('8b3daf8cc76d3a98fa0c60365319d05488aadd61017cd28c2fd19d8b07ed3b35d4ffea85ecbc7203dcdcd9dad86e85371edae24be4aa805b9a869a90f4123f7f')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-python-geoip() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-python-geoip() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

